package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.RegisterCompany;
import com.ruoyi.system.service.IRegisterCompanyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 注册公司信息管理Controller
 * 
 * @author ruoyi
 * @date 2024-05-24
 */
@RestController
@RequestMapping("/system/register_company")
public class RegisterCompanyController extends BaseController
{
    @Autowired
    private IRegisterCompanyService registerCompanyService;

    /**
     * 查询注册公司信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:register_company:list')")
    @GetMapping("/list")
    public TableDataInfo list(RegisterCompany registerCompany)
    {
        startPage();
        List<RegisterCompany> list = registerCompanyService.selectRegisterCompanyList(registerCompany);
        return getDataTable(list);
    }

    /**
     * 导出注册公司信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:register_company:export')")

    @PostMapping("/export")
    public void export(HttpServletResponse response, RegisterCompany registerCompany)
    {
        List<RegisterCompany> list = registerCompanyService.selectRegisterCompanyList(registerCompany);
        ExcelUtil<RegisterCompany> util = new ExcelUtil<RegisterCompany>(RegisterCompany.class);
        util.exportExcel(response, list, "注册公司信息管理数据");
    }

    /**
     * 获取注册公司信息管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:register_company:query')")
    @GetMapping(value = "/{registerCompanyId}")
    public AjaxResult getInfo(@PathVariable("registerCompanyId") Long registerCompanyId)
    {
        return success(registerCompanyService.selectRegisterCompanyByRegisterCompanyId(registerCompanyId));
    }

    /**
     * 新增注册公司信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:register_company:add')")

    @PostMapping
    public AjaxResult add(@RequestBody RegisterCompany registerCompany)
    {
        return toAjax(registerCompanyService.insertRegisterCompany(registerCompany));
    }

    /**
     * 修改注册公司信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:register_company:edit')")

    @PutMapping
    public AjaxResult edit(@RequestBody RegisterCompany registerCompany)
    {
        return toAjax(registerCompanyService.updateRegisterCompany(registerCompany));
    }

    /**
     * 删除注册公司信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:register_company:remove')")

	@DeleteMapping("/{registerCompanyIds}")
    public AjaxResult remove(@PathVariable Long[] registerCompanyIds)
    {
        return toAjax(registerCompanyService.deleteRegisterCompanyByRegisterCompanyIds(registerCompanyIds));
    }
}
